/*
 * Copyright 2012-2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot.autoconfigure;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springframework.boot.context.annotation.ImportCandidates;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor;

/**
 * 导入并应用指定的自动配置类。应用与 {@code @EnableAutoConfiguration} 相同的排序规则，
 * 但限制自动配置类为指定的集合，而不是从 {@link ImportCandidates} 中获取。
 * <p>
 * 也可用于 {@link #exclude()} 指定不应被应用的自动配置类。
 * <p>
 * 通常应优先使用 {@code @EnableAutoConfiguration}，但 {@code @ImportAutoConfiguration}
 * 在某些情况下特别是编写测试时非常有用。
 *
 * @author Phillip Webb
 * @author Andy Wilkinson
 * @since 1.3.0
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Import(ImportAutoConfigurationImportSelector.class)
public @interface ImportAutoConfiguration {

	/**
	 * 应导入的自动配置类。此属性是 {@link #classes()} 的别名。
	 * @return 要导入的类
	 */
	@AliasFor("classes")
	Class<?>[] value() default {};

	/**
	 * 应导入的自动配置类。当为空时，类通过 {@code META-INF/spring} 目录下
	 * 以被注解类全限定名加 '.imports' 后缀的文件指定。
	 * @return 要导入的类
	 */
	@AliasFor("value")
	Class<?>[] classes() default {};

	/**
	 * 排除特定的自动配置类，使其永远不会被应用。
	 * @return 要排除的类
	 */
	Class<?>[] exclude() default {};

}
